﻿using System;
namespace GtsServer.Model
{
    /// <summary>
    /// 1
    /// </summary>
    [Serializable]
    public partial class Task
    {
        public Task()
        { }
        #region Model
        private int _id;
        private string _name;
        private int _tasktypeid;
        private DateTime _cratetime;
        private DateTime _starttime;
        private DateTime _endtime;
        private bool? _isremind;
        private int _state;
        private bool _isAllVisual;
        private int _emptyUnit;
        private bool _isReachCondition;
        private string _taskContent;
        private string _taskRemark;
        private string _imageType;
        private int _initGold;
        private int _sortNum;
        private bool _isUseStage;

        public bool IsUseStage
        {
            get { return _isUseStage; }
            set { _isUseStage = value; }
        }

        public int SortNum
        {
            get { return _sortNum; }
            set { _sortNum = value; }
        }

        public int InitGold
        {
            get { return _initGold; }
            set { _initGold = value; }
        }

        public string ImageType
        {
            get { return _imageType; }
            set { _imageType = value; }
        }

        public string TaskRemark
        {
            get { return _taskRemark; }
            set { _taskRemark = value; }
        }

        public string TaskContent
        {
            get { return _taskContent; }
            set { _taskContent = value; }
        }

        public bool IsReachCondition
        {
            get { return _isReachCondition; }
            set { _isReachCondition = value; }
        }

        public int EmptyUnit
        {
            get { return _emptyUnit; }
            set { _emptyUnit = value; }
        }

        public bool IsAllVisual
        {
            get { return _isAllVisual; }
            set { _isAllVisual = value; }
        }
        /// <summary>
        /// 
        /// </summary>
        public int ID
        {
            set { _id = value; }
            get { return _id; }
        }
        /// <summary>
        /// 任务名称
        /// </summary>
        public string Name
        {
            set { _name = value; }
            get { return _name; }
        }
        /// <summary>
        /// 任务类型
        /// </summary>
        public int TaskTypeID
        {
            set { _tasktypeid = value; }
            get { return _tasktypeid; }
        }
        /// <summary>
        /// 任务创建时间
        /// </summary>
        public DateTime CrateTime
        {
            set { _cratetime = value; }
            get { return _cratetime; }
        }
        /// <summary>
        /// 任务开始时间
        /// </summary>
        public DateTime StartTime
        {
            set { _starttime = value; }
            get { return _starttime; }
        }
        /// <summary>
        /// 任务结束时间
        /// </summary>
        public DateTime EndTime
        {
            set { _endtime = value; }
            get { return _endtime; }
        }
        /// <summary>
        /// 是否公告提醒
        /// </summary>
        public bool? IsRemind
        {
            set { _isremind = value; }
            get { return _isremind; }
        }
        /// <summary>
        /// 任务状态（未开始、进行中、结束）
        /// </summary>
        public int State
        {
            set { _state = value; }
            get { return _state; }
        }
        #endregion Model

    }

    public class TaskShow : Task
    {
        public TaskShow() { }
        public TaskShow(Task model)
        {
            this.ID = model.ID;
            this.Name = model.Name;
            this.TaskTypeID = model.TaskTypeID;
            this.CrateTime = model.CrateTime;
            this.StartTime = model.StartTime;
            this.EndTime = model.EndTime;
            this.IsRemind = model.IsRemind;
            this.IsAllVisual = model.IsAllVisual;
            this.EmptyUnit = model.EmptyUnit;
            this.State = model.State;
            this.IsReachCondition = model.IsReachCondition;
            this.TaskContent = model.TaskContent;
            this.TaskRemark = model.TaskRemark;
            this.InitGold = model.InitGold;
            this.ImageType = model.ImageType;
            this.SortNum = model.SortNum;
            this.IsUseStage = model.IsUseStage;
             
            if (this.State.Equals(Convert.ToInt32(EnumTaskState.未开始)))
                this.StateName = EnumTaskState.未开始.ToString();
            else if (this.State.Equals(Convert.ToInt32(EnumTaskState.进行中)))
                this.StateName = EnumTaskState.进行中.ToString();
            else if (this.State.Equals(Convert.ToInt32(EnumTaskState.已结束)))
                this.StateName = EnumTaskState.已结束.ToString();

            if (this.EmptyUnit.Equals(Convert.ToInt32(EnumEnptyUnit.不清空)))
                this.EmptyUnitName = EnumEnptyUnit.不清空.ToString();
            else if (this.EmptyUnit.Equals(Convert.ToInt32(EnumEnptyUnit.天)))
                this.EmptyUnitName = EnumEnptyUnit.天.ToString();
            else if (this.EmptyUnit.Equals(Convert.ToInt32(EnumEnptyUnit.周)))
                this.EmptyUnitName = EnumEnptyUnit.周.ToString();
            else if (this.EmptyUnit.Equals(Convert.ToInt32(EnumEnptyUnit.月)))
                this.EmptyUnitName = EnumEnptyUnit.月.ToString();
            else if (this.EmptyUnit.Equals(Convert.ToInt32(EnumEnptyUnit.年)))
                this.EmptyUnitName = EnumEnptyUnit.年.ToString();
        }

        private string _emptyUnitName;

        public string EmptyUnitName
        {
            get { return _emptyUnitName; }
            set { _emptyUnitName = value; }
        }

        private string _stateName;

        public string StateName
        {
            get { return _stateName; }
            set { _stateName = value; }
        }
    }
}

